/**
 * 功能描述
 */
define(function (require, exports, module) {
    //引入视图基类
    var ELView = require("elview");
    var aw = require("ajaxwrapper");
    //assets
    var template = require("./assets/tpl/checkoutroomconfirm_main.tpl");
    require("./assets/css/checkoutroomconfirm_main.css");

    var checkoutRoomSubnavComp = require("./component/checkoutRoomSubnavComp");
    var checkoutRoomGridComp = require("./component/checkoutRoomGridComp");
    var checkoutRoomFormComp = require("./component/checkoutRoomFormComp");
    var checkoutRoomTopFormComp = require("./component/checkoutRoomTopFormComp");
    var roomPerGridComp = require("./component/roomPerGridComp");
    var roomConsumpEditGrid = require("./component/roomConsumpEditGrid");
    var damagesConsumpEditGrid = require("./component/damagesConsumpEditGrid");
    var roomConsumpDetailGrid = require("./component/roomConsumpDetailGrid");
    var damagesConsumpDetailGrid = require("./component/damagesConsumpDetailGrid");
    
    var subnavEvents = require("./handler/subnavEvents");
    var gridEvents = require("./handler/gridEvents");
    
    var App = ELView.extend({
        attrs: {
            template: template
        },
        handler: {
        	gridHandler: gridEvents
        },
        memDataSource: true, // 区分老人团 
        showDetail: false,
        initComponent: function (params, widget) {
        	checkoutRoomSubnavComp.initComponent(params, widget);
        	checkoutRoomGridComp.initComponent(params, widget);
        	checkoutRoomTopFormComp.initComponent(params, widget);
        	checkoutRoomFormComp.initComponent(params, widget);
        	roomPerGridComp.initComponent(params, widget);
        	roomConsumpEditGrid.initComponent(params, widget);
        	damagesConsumpEditGrid.initComponent(params, widget);
        	roomConsumpDetailGrid.initComponent(params, widget);
        	damagesConsumpDetailGrid.initComponent(params, widget);
        },
        afterInitComponent: function (params, widget) {
            subnavEvents.loadBuilding(widget);
            widget.get("grid").refresh();
        	aw.ajax({
				url:"api/baseprice/getprice",
				dataType:"json",
				success:function(data){
					widget.set("baseprice",data);
				}
			});
        }
    });

    module.exports = App;
});
